[Deepin-Kernel-SIG] [linux 6.6-y] [Upstream] [Alibaba] [ARM] Support CMN700 PMU metric for Neoverse (CMN PMU metric回合6.6内核)#832
Conversation
ANBZ: #8601 commit 5440999 upstream. The jevent "Compat" is used for uncore PMU alias or metric definitions. The same PMU driver has different PMU identifiers due to different hardware versions and types, but they may have some common PMU metric. Since a Compat value can only match one identifier, when adding the same metric to PMUs with different identifiers, each identifier needs to be defined once, which is not streamlined enough. So let "Compat" support using regular expression to match multiple identifiers for uncore PMU metric. Signed-off-by: Jing Zhang <renyu.zj@linux.alibaba.com> Reviewed-by: John Garry <john.g.garry@oracle.com> Reviewed-by: Ian Rogers <irogers@google.com> Tested-by: Ian Rogers <irogers@google.com> Cc: James Clark <james.clark@arm.com> Cc: Will Deacon <will@kernel.org> Cc: Leo Yan <leo.yan@linaro.org> Cc: Mike Leach <mike.leach@linaro.org> Cc: Shuai Xue <xueshuai@linux.alibaba.com> Cc: Zhuo Song <zhuo.song@linux.alibaba.com> Cc: linux-arm-kernel@lists.infradead.org Cc: linux-doc@vger.kernel.org Link: https://lore.kernel.org/r/1695794391-34817-3-git-send-email-renyu.zj@linux.alibaba.com Signed-off-by: Namhyung Kim <namhyung@kernel.org> Signed-off-by: Jing Zhang <renyu.zj@linux.alibaba.com>
ANBZ: #8601 commit e3e42e2 upstream. The previous code assumes an event has either an "event=" or "config" field at the beginning. For CMN neither of these may be present, as an event is typically "type=xx,eventid=xxx". So add EventidCode and NodeType to support CMN event description. I compared pmu_event.c before and after compiling with JEVENT_ARCH=all, they are consistent. Signed-off-by: Jing Zhang <renyu.zj@linux.alibaba.com> Reviewed-by: Ian Rogers <irogers@google.com> Tested-by: Ian Rogers <irogers@google.com> Cc: James Clark <james.clark@arm.com> Cc: Will Deacon <will@kernel.org> Cc: Leo Yan <leo.yan@linaro.org> Cc: Mike Leach <mike.leach@linaro.org> Cc: Shuai Xue <xueshuai@linux.alibaba.com> Cc: Zhuo Song <zhuo.song@linux.alibaba.com> Cc: John Garry <john.g.garry@oracle.com> Cc: linux-arm-kernel@lists.infradead.org Cc: linux-doc@vger.kernel.org Link: https://lore.kernel.org/r/1695794391-34817-4-git-send-email-renyu.zj@linux.alibaba.com Signed-off-by: Namhyung Kim <namhyung@kernel.org> Signed-off-by: Jing Zhang <renyu.zj@linux.alibaba.com>
ANBZ: #8601 commit 3bb59e7 upstream. The perf_pmu_test_event.matching_pmu didn't work. No matter what its value is, it does not affect the test results. So let matching_pmu be used for matching perf_pmu_test_pmu.pmu.name. Signed-off-by: Jing Zhang <renyu.zj@linux.alibaba.com> Reviewed-by: John Garry <john.g.garry@oracle.com> Reviewed-by: Ian Rogers <irogers@google.com> Tested-by: Ian Rogers <irogers@google.com> Cc: James Clark <james.clark@arm.com> Cc: Will Deacon <will@kernel.org> Cc: Leo Yan <leo.yan@linaro.org> Cc: Mike Leach <mike.leach@linaro.org> Cc: Shuai Xue <xueshuai@linux.alibaba.com> Cc: Zhuo Song <zhuo.song@linux.alibaba.com> Cc: linux-arm-kernel@lists.infradead.org Cc: linux-doc@vger.kernel.org Link: https://lore.kernel.org/r/1695794391-34817-5-git-send-email-renyu.zj@linux.alibaba.com Signed-off-by: Namhyung Kim <namhyung@kernel.org> Signed-off-by: Jing Zhang <renyu.zj@linux.alibaba.com>
ANBZ: #8601 commit 7fded33 upstream. Add new event test for uncore system event which is used to verify the functionality of "Compat" matching multiple identifiers and the new event fields "EventidCode" and "NodeType". Signed-off-by: Jing Zhang <renyu.zj@linux.alibaba.com> Reviewed-by: Ian Rogers <irogers@google.com> Tested-by: Ian Rogers <irogers@google.com> Cc: James Clark <james.clark@arm.com> Cc: Will Deacon <will@kernel.org> Cc: Leo Yan <leo.yan@linaro.org> Cc: Mike Leach <mike.leach@linaro.org> Cc: Shuai Xue <xueshuai@linux.alibaba.com> Cc: Zhuo Song <zhuo.song@linux.alibaba.com> Cc: John Garry <john.g.garry@oracle.com> Cc: linux-arm-kernel@lists.infradead.org Cc: linux-doc@vger.kernel.org Link: https://lore.kernel.org/r/1695794391-34817-6-git-send-email-renyu.zj@linux.alibaba.com Signed-off-by: Namhyung Kim <namhyung@kernel.org> Signed-off-by: Jing Zhang <renyu.zj@linux.alibaba.com>
ANBZ: #8601 commit 0b4de7b upstream. Currently just add aliases for part of Arm CMN PMU events which are general and compatible for any SoC and CMN-ANY. "Compat" value "(434|436|43c|43a).*" means it is compatible with all CMN600/CMN650/CMN700/Ci700, which can be obtained from commit 7819e05 ("perf/arm-cmn: Revamp model detection"). The arm-cmn PMU events got from: [0] https://developer.arm.com/documentation/100180/0302/?lang=en [1] https://developer.arm.com/documentation/101408/0100/?lang=en [2] https://developer.arm.com/documentation/102308/0302/?lang=en [3] https://developer.arm.com/documentation/101569/0300/?lang=en Signed-off-by: Jing Zhang <renyu.zj@linux.alibaba.com> Reviewed-by: John Garry <john.g.garry@oracle.com> Reviewed-by: Ian Rogers <irogers@google.com> Tested-by: Ian Rogers <irogers@google.com> Cc: James Clark <james.clark@arm.com> Cc: Will Deacon <will@kernel.org> Cc: Leo Yan <leo.yan@linaro.org> Cc: Mike Leach <mike.leach@linaro.org> Cc: Shuai Xue <xueshuai@linux.alibaba.com> Cc: Zhuo Song <zhuo.song@linux.alibaba.com> Cc: linux-arm-kernel@lists.infradead.org Cc: linux-doc@vger.kernel.org Link: https://lore.kernel.org/r/1695794391-34817-7-git-send-email-renyu.zj@linux.alibaba.com Signed-off-by: Namhyung Kim <namhyung@kernel.org> Signed-off-by: Jing Zhang <renyu.zj@linux.alibaba.com>
ANBZ: #8601 commit 4f3ee7d upstream. Add JSON metrics for Arm CMN. Currently just add part of CMN PMU metrics which are general and compatible for any SoC with CMN-ANY. Signed-off-by: Jing Zhang <renyu.zj@linux.alibaba.com> Reviewed-by: John Garry <john.g.garry@oracle.com> Reviewed-by: Ian Rogers <irogers@google.com> Tested-by: Ian Rogers <irogers@google.com> Cc: James Clark <james.clark@arm.com> Cc: Will Deacon <will@kernel.org> Cc: Leo Yan <leo.yan@linaro.org> Cc: Mike Leach <mike.leach@linaro.org> Cc: Shuai Xue <xueshuai@linux.alibaba.com> Cc: Zhuo Song <zhuo.song@linux.alibaba.com> Cc: linux-arm-kernel@lists.infradead.org Cc: linux-doc@vger.kernel.org Link: https://lore.kernel.org/r/1695794391-34817-8-git-send-email-renyu.zj@linux.alibaba.com Signed-off-by: Namhyung Kim <namhyung@kernel.org> Signed-off-by: Jing Zhang <renyu.zj@linux.alibaba.com>
Reviewer's GuideIntegrates CMN700 PMU metric support for ARM by extending perf tests, event generator, empty definitions, JSON descriptors, and identifier matching logic to accommodate new eventid-based uncore events. ER Diagram: Enhanced PMU Event Definition Structure (JSON and C)erDiagram
JSON_EVENT_DEFINITION {
string EventName PK
string EventCode "Optional, hex"
string ConfigCode "Optional, hex"
string EventidCode "Optional, hex (New)"
string UMask "Optional, hex"
string NodeType "Optional, string (New)"
string Compat "Optional, regex string"
string Desc "Optional, string"
string Topic "Optional, string"
string PMU_Name "Optional, string"
boolean Precise "Optional"
}
PMU_EVENT_C_STRUCT {
string name PK
string event_string "e.g., 'eventid=0x1,type=0x5' (New format capability)"
string desc
string compat
string topic
string pmu
}
JSON_EVENT_DEFINITION ||--|{ PMU_EVENT_C_STRUCT : "Defines content for"
Class Diagram: Updates to PMU Event Handling in jevents.pyclassDiagram
class EventDataInput {
<<JSON data fields parsed by jevents.py>>
# Existing fields: EventName, ConfigCode, EventCode etc.
+EventidCode: any # New field expected from input JSON
+NodeType: any # New field expected from input JSON
}
class JEventsPyModuleConfig {
<<Data structures modified in jevents.py>>
+unit_to_pmu_map: map~string, string~ # Modified: Added 'arm_cmn':'arm_cmn'
+event_string_field_configs: list~tuple~ # Modified: Added ('NodeType', 'type=') for processing
}
EventDataInput --|> JEventsPyModuleConfig : Informs event processing logic and data structures
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
deepin pr auto review代码审查意见:
以上是本次代码审查的主要意见,希望能够对您的代码改进有所帮助。 |
There was a problem hiding this comment.
Pull Request Overview
Adds support for ARM CMN700 uncore PMU metrics to Perf utilities and tests.
- Extend
metricgroup.cto usepmu_uncore_identifier_matchfor regex-based PMU ID matching - Introduce
sys_cmn_pmu_hnf_cache_missevent in tests and JSON definitions - Update
jevents.pyto parseEventidCode/NodeTypeand maparm_cmnunit - Provide new metric definitions in
tools/perf/pmu-events/arch/arm64/arm/cmn/sys/metric.json
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tools/perf/util/metricgroup.c | Switch from strcmp to pmu_uncore_identifier_match |
| tools/perf/tests/pmu-events.c | Add sys_cmn_pmu_hnf_cache_miss event and test entries |
| tools/perf/pmu-events/jevents.py | Parse EventidCode/NodeType; add 'arm_cmn' mapping |
| tools/perf/pmu-events/empty-pmu-events.c | Add empty PMU event for CMN700 |
| tools/perf/pmu-events/arch/test/test_soc/sys/uncore.json | Add JSON entry for hnf_cache_miss event |
| tools/perf/pmu-events/arch/arm64/arm/cmn/sys/metric.json | New metric definitions for CMN700 |
| tools/perf/pmu-events/arch/arm64/arm/cmn/sys/cmn.json | New event definitions for CMN700 |
Comments suppressed due to low confidence (2)
tools/perf/pmu-events/jevents.py:292
- The unit-to-PMU mapping for 'arm_cmn' returns 'arm_cmn', which may not match the actual perf PMU name (e.g., 'uncore_sys_cmn_pmu'). Consider updating this mapping to the correct PMU identifier.
'arm_cmn': 'arm_cmn',
tools/perf/pmu-events/arch/arm64/arm/cmn/sys/metric.json:8
- The 'Unit' field is set to 'arm_cmn', which may not align with other CMN PMU units (e.g., 'sys_cmn_pmu'). Verify that consumers will recognize this unit name or adjust it for consistency.
"Unit": "arm_cmn",
| }, | ||
| { | ||
| "MetricName": "rni_actual_read_bandwidth.all", | ||
| "BriefDescription": "This event measure the actual bandwidth that RN-I bridge sends to the interconnect.", |
There was a problem hiding this comment.
Grammar: 'This event measure' should be 'This event measures' to match subject–verb agreement.
| "BriefDescription": "This event measure the actual bandwidth that RN-I bridge sends to the interconnect.", | |
| "BriefDescription": "This event measures the actual bandwidth that RN-I bridge sends to the interconnect.", |
| }, | ||
| { | ||
| "MetricName": "sbsx_actual_write_bandwidth.all", | ||
| "BriefDescription": "sbsx actual write bandwidth.", |
There was a problem hiding this comment.
[nitpick] Documentation could be more descriptive—consider adding an article and clarifying context (e.g., 'The SBSX actual write bandwidth for channel X').
| .count = &matched_count, | ||
| }; | ||
|
|
||
| if (strcmp(pmu_name, test_event.matching_pmu)) { |
There was a problem hiding this comment.
[nitpick] Use an explicit comparison (strcmp(...) != 0) to make the intent of the mismatch check clearer.
| if (strcmp(pmu_name, test_event.matching_pmu)) { | |
| if (strcmp(pmu_name, test_event.matching_pmu) != 0) { |
There was a problem hiding this comment.
Hey @Avenger-285714 - I've reviewed your changes - here's some feedback:
- The four nearly identical sys_cmn_pmu_hnf_cache_miss test entries could be refactored into a parameterized loop or table to reduce duplication and ease future updates.
- Consider anchoring or refining the compat regex (e.g. adding ^/$) to prevent unintended ID matches in pmu_uncore_identifier_match.
- Double-check that mapping 'arm_cmn' in unit_to_pmu aligns with the existing uncore naming convention (e.g. using 'uncore_arm_cmn') for consistency across target units.
Here's what I looked at during the review
- 🟢 General issues: all looks good
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
|
Checkdepends: |
Link: https://bugzilla.openanolis.cn/show_bug.cgi?id=8601
回合CMN700 PMU metric 到 6.6 内核。
Link: https://gitee.com/anolis/cloud-kernel/pulls/2937
deepin: Drop ("perf pmu: "Compat" supports regular expression matching identifiers") because of merged before.
Summary by Sourcery
Add CMN700 PMU metric support in perf by extending event generator, updating matching logic, and adding test coverage
New Features:
Enhancements:
Tests: